Wireless M-Bus
api.wmbusSetup(...)
- Overview
- Arguments
- Return
- Example 1
- Example 2
Changes the configuration of W M-bus.
in case of api.wmbusSetup(power, role, mode):
- power (integer) - W M-bus power: -20 dBm, -10 dBm, 0 dBm, 2 dBm, 4 dBm
- role (string) - W M-bus role: master, slave, meter, concentrator, repeater
- mode (string) - W M-bus mode: S1, S2, T1, T2, T1_C, T2_C, R, METRA, SENSUS434, SONTEX433
in case of api.wmbusSetup("property",value):
- "property" (string):
- "ROLE" - W M-bus role: master, slave, meter, concentrator, repeater
- "MODE" - W M-bus mode: S1, S2, T1, T2, T1_C, T2_C, R, METRA, SENSUS434, SONTEX433
- "IGNORE_CRC" - true, false
- "DISABLE_MADDALENA_ARROW_SUPPORT" - true, false
- value - property value
To configure Duty Cycle api.wmbusSetup("RX_DUTY_CYCLE",arg1,arg2,arg3):
- arg1 (bool) - property value, or duty cycle state (true, false)
- arg2 (integer) - duty cycle RX time
- arg3 (integer) - duty cycle Sleep time
- status (integer) - Positive or zero for success, negative for failure
--setup W M-bus interface to power of 10 dBm, role master/concentrator and T2 mode
api.wmbusSetup(10, "master", "T2")
--setup W M-bus interface T2 mode
api.wmbusSetup("MODE", "T2")
api.wmbusSetHeader(manid, id, version, devtype)
- Overview
- Arguments
- Return
- Example
Sets W M-bus header.
- manid (integer) - Manufacturer ID, max value 0xffff
- id (integer) - ID of W M-bus device (32 bit)
- version (integer) - Version fiels, max value 0xff
- devtype (integer) - Device version field, max value 0xff
- status (integer) - Positive or zero for success, negative for failure
-- Set W M-bus header for specific device
print("--- W M-bus T1 Digital Thermometer ---")
api.wmbusSetup(10, "meter", "T1")
api.wmbusSetCField(17)
api.wmbusSetHeader(123, 123456, 2, 33)
api.wmbusSendFrame(ci, data)
- Overview
- Arguments
- Return
- Example
Sends frame through W M-bus.
- ci (integer) - CI field
- data (string) - Frame to be sent
- status (integer) - Positive or zero for success, negative for failure
-- Send W M-bus frame
api.wmbusSendFrame(212, "foobar")
api.wmbusReceiveFrame(timeout)
- Overview
- Arguments
- Return
- Example
Waits timeout milliseconds for data reception from W M-bus.
- timeout (integer) - The maximum time in milliseconds to wait for WMBUS device answer
- status (integer) - Positive or zero for success, negative for failure
- c_field (integer) - W M-bus C field (max value 255)
- manid (integer) - Manufacturer ID, max value 0xffff
- id (integer) - ID of W M-bus device (32 bit)
- version (integer) - Version fiels, max value 0xff
- devtype (integer) - Device version field, max value 0xff
- ci (integer) - CI field
- payload (string) - Received frame payload
-- Receive W M-bus data with 2000 ms timeout
status, cfield, manid, id, ver, devtype, ci, payload = api.wmbusReceiveFrame(2000)
print(status)
print(id)
print(payload)
api.wmbusReceiveSendFrame(ci, payload, timeout)
- Overview
- Arguments
- Return
- Example
Waits timeout milliseconds for data reception from W M-bus.
Only available for W M-bus in concentrator role.
- ci (integer) - CI field
- payload (string) - Payload to be send
- timeout (integer) - The maximum time in milliseconds to wait for RS485 device answer
- status (integer) - Positive or zero for success, negative for failure
- c_field (integer) - W M-bus C field (max value 255)
- manid (integer) - Manufacturer ID, max value 0xffff
- id (integer) - ID of W M-bus device (32 bit)
- version (integer) - Version fiels, max value 0xff
- devtype (integer) - Device version field, max value 0xff
- ci (integer) - CI field
- payload (string) - Received frame payload
x=string.char(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF)
status, cfield, manid, id, ver, devtype, ci, payload = api.wmbusReceiveSendFrame(200, x, 2000)
print(status)
print(id)
print(payload)
api.wmbusSendReceiveFrame(ci, payload, debugon)
- Overview
- Arguments
- Return
- Example
Send data and receive from W M-bus device
This function is only available for W M-bus in meter role.
- ci (integer) -CI field
- payload (string) - Payload to be send
- debugon (integer) - If 1, then debug prints of wmbus frame will be present in stdout
- status (integer) - Positive or zero for success, negative for failure
- c_field (integer) - W M-bus C field (max value 255)
- manid (integer) - Manufacturer ID, max value 0xffff
- id (integer) - ID of W M-bus device (32 bit)
- version (integer) - Version fiels, max value 0xff
- devtype (integer) - Device version field, max value 0xff
- ci (integer) - CI field
- payload (string) - Received frame payload
x=string.char(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF)
status, cfield, manid, id, ver, devtype, ci, payload = api.wmbusReceiveSendFrame(200, x)
print(status)
print(id)
print(payload)
api.wmbusFilter(operation, filter)
- Overview
- Arguments
- Return
Fubction and it's operations to set and filter received Wireless M-Bus frame.
This function is only available for W M-bus in meter role.
- operation (string):
- "purge" - remove the WMBus filter table
- "populate" - insert the filter into the WMBus filter table
- "show" - show the content of WMBus filter
- "fetch" - returns length of WMBus filter
- "show-length" - show length of the filter
- "show-index" - show index for defined filter
- "add" - to add a filter (max length 4B)
- filter (string) - W M-Bus filter
- status (integer) - integer value acording to operation
- WMBUSfilterLength (string) - length of W M-Bus filter